﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.IO;
using Chaliy.DbPro.Generators.TextAuthoring.Configuration;

namespace Chaliy.DbPro.Generators.Tests.TextAuthoring.Confgiration
{
	[TestClass]
	public class TextConfigurationTests
	{
		[TestMethod]
		[DeploymentItem(DeploymentConstants.GeneratorsDll)]
		public void TestLoad()
		{
			using (Stream configurationStream = new MemoryStream(Resources.EtalonConfiguration))
			{
				TextConfiguration configuration = TextConfiguration.Load(configurationStream);
				Assert.IsNotNull(configuration);
			}
		}

		[TestMethod]
		[DeploymentItem(DeploymentConstants.GeneratorsDll)]
		[ExpectedException(typeof(ArgumentNullException))]
		public void TestLoadEmptyArgument()
		{			
			// Expected exception because Load cannot work with empty stream.
			TextConfiguration.Load(null);			
		}

		[TestMethod]
		[DeploymentItem(DeploymentConstants.GeneratorsDll)]
		public void TestParagraphConfiguration()
		{
			TextConfiguration configuration = DataUtlities.CreateEtalonData();
			Assert.IsNotNull(configuration.Paragraph);
		}

		[TestMethod]
		[DeploymentItem(DeploymentConstants.GeneratorsDll)]
		public void TestSentanceConfiguration()
		{
			TextConfiguration configuration = DataUtlities.CreateEtalonData();
			Assert.IsNotNull(configuration.Sentance);
		}

		[TestMethod]
		[DeploymentItem(DeploymentConstants.GeneratorsDll)]
		public void TestWordConfiguration()
		{
			TextConfiguration configuration = DataUtlities.CreateEtalonData();
			Assert.IsNotNull(configuration.Word);
		}
	}
}
